#pragma once

//zhuliang.li, this class used to supply the data
//			   can be modified to wrap the ado operation
//			   temporarily supply fake from file
//NOTE: for this class is not fully designed,
//      not decided put it in which namespace
//      temporarily put in global

#include <vector>

typedef unsigned int UINT;
typedef std::vector< double > dVec;
typedef std::vector< UINT > uVec;

class DataSupplier
{
private:
    static DataSupplier* ms_instance;

public:
    static DataSupplier* S();
    static void Destory();

public:
    bool    InitFromFile( const wchar_t* p_fl );
    //implement this by different requirements
    //result data stroe in the given vector in the sequence of cx, cy, act, sd
    UINT    PeekData( dVec& pData );
    bool    IsEOF() const;
    bool    IsInited() const { return m_isInited; }
    void    Reset() { m_currIdx = 0; }
    double  QueryTime();
    double  QueryPTime();

private:
	DataSupplier(void);
	virtual ~DataSupplier(void);

private:
    void    PreProcessing();
    void    ClearData();

private:
    unsigned int    m_currIdx;
    bool            m_isInited;
    wchar_t*        m_fileName;
    
    uVec            m_ID;
    dVec            m_CX;
    dVec            m_CY;
    dVec            m_Act;
    dVec            m_SD;

};

